﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefMachineStatusRecord" :model="stateMachineStatusRecord.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_FactoryCode_FormItem" prop="Entity.FactoryCode" :label="$t('message.autotrans._Model_MachineStatusRecord_factoryCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_MachineStatusRecord_factoryCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.FactoryCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_MachineStatusRecord_lineCode')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StationCode_FormItem" prop="Entity.StationCode" :label="$t('message.autotrans._Model_MachineStatusRecord_stationCode')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.StationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MachineCode_FormItem" prop="Entity.MachineCode" :label="$t('message.autotrans._Model_MachineStatusRecord_machineCode')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.MachineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MachineStatusCode_FormItem" prop="Entity.MachineStatusCode" :label="$t('message.autotrans._Model_MachineStatusRecord_machineStatusCode')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.MachineStatusCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AcquistCode_FormItem" prop="Entity.AcquistCode" :label="$t('message.autotrans._Model_MachineStatusRecord_acquistCode')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.AcquistCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MachineStatusBegin_FormItem" prop="Entity.MachineStatusBegin" :label="$t('message.autotrans._Model_MachineStatusRecord_machineStatusBegin')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.MachineStatusBegin" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MachineStatusEnd_FormItem" prop="Entity.MachineStatusEnd" :label="$t('message.autotrans._Model_MachineStatusRecord_machineStatusEnd')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.MachineStatusEnd" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditTime_FormItem" prop="Entity.EditTime" :label="$t('message.autotrans._Model_MachineStatusRecord_editTime')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.EditTime" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StatusType_FormItem" prop="Entity.StatusType" :label="$t('message.autotrans._Model_MachineStatusRecord_StatusType')">
            <el-input v-model="stateMachineStatusRecord.vmModel.Entity.StatusType" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Uploadflag_FormItem" prop="Entity.Uploadflag" :label="$t('message.autotrans._Model_MachineStatusRecord_uploadflag')">
            <el-select v-model="stateMachineStatusRecord.vmModel.Entity.Uploadflag" clearable>
               <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
               <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onSubmitMachineStatusRecord"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

        <WtmButton @click="onCloseMachineStatusRecord"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageRecordMachineStatusRecordCreate;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { machinestatusrecordApi } from '/@/api/record/machinestatusrecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefMachineStatusRecord = ref();
const stateMachineStatusRecord = reactive({
    vmModel: {
	  Entity:{
        FactoryCode: '',
        LineCode: '',
        StationCode: '',
        MachineCode: '',
        MachineStatusCode: '',
        AcquistCode: '',
        MachineStatusBegin: '',
        MachineStatusEnd: '',
        EditTime: '',
        StatusType: '',
        Uploadflag: undefined,
      },

	},
    
});

// 取消
const onCloseMachineStatusRecord = () => {
    closeDialog();
};

// 提交
const onSubmitMachineStatusRecord = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefMachineStatusRecord.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            machinestatusrecordApi().add(stateMachineStatusRecord.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

